package com.aggron.flow;

import com.bstek.uflo.env.Context;
import com.bstek.uflo.model.ProcessInstance;
import com.bstek.uflo.process.handler.AssignmentHandler;
import com.bstek.uflo.process.node.TaskNode;
import com.bstek.uflo.service.StartProcessInfo;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.List;

/**
 * Created by Administrator on 2018/6/17.
 */
@Component
public class Assigner  implements AssignmentHandler {
    @Override
    public Collection<String> handle(TaskNode taskNode, ProcessInstance processInstance, Context context) {
        List<String> userList= Lists.newArrayList();
        StartProcessInfo startProcessInfo=new StartProcessInfo("demo");
      startProcessInfo.setBusinessId("id");
      //startProcessInfo.setVariables();
        userList.add("managner");
        return userList;
    }
    /**
     * 1.开启流程
     *  StartProcessInfo startProcessInfo=new StartProcessInfo("demo");
     *  startProcessInfo.setBusinessId("id");
     *  Map<String,Object> map=new HashMap<String,Object>();
     *  map.put("approve","superMan")//指定人
     *  sta</></>
     *  startProcessInfo.setVariables(map);
     *ProcessService processService=new DefaultProcessService();
     *processService.startProcessByName("demo",startProcessInfo);
     *
     * 2.审批
     * taskService。start(taskId);
     * task.Service.complete(taskId,new TaskOption("ok"))
     */
}
